# Makefile
CC = gcc
CFLAGS = -I./include -Wall -Wextra -O2
LDFLAGS = -L/path/to/gmssl/lib -lgmssl -lcrypto
INCLUDE_DIRS = -I./include -I/path/to/gmssl/include
BIN_DIR = ./bin
SRC_DIR = ./src

TARGET = $(BIN_DIR)/testsdf
OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BIN_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))

all: $(TARGET)

$(TARGET): $(OBJECTS)
	$(CC) $(CFLAGS) $(INCLUDE_DIRS) $^ -o $@ $(LDFLAGS)

$(BIN_DIR)/%.o: $(SRC_DIR)/%.c
	mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDE_DIRS) -c $< -o $@

clean:
	rm -f $(OBJECTS) $(TARGET)

.PHONY: all clean
